<template>
  <div class="background">
    <a-tabs default-active-key="2" size="large" @change="tabsChange">
      <a-tab-pane v-for="(item, index) in tabOption" :key="item.key_value" :tab="item.key_name">
        <component ref="childComponentRef" :is="item.component" />
      </a-tab-pane>
    </a-tabs>
  </div>
</template>

<script>
import Qinghua from './Qinghua.vue'
import Shumian from './Shumian.vue'
import Jingshu from './Jingshu.vue'
import Bingtiao from './Bingtiao.vue'
import Cusha from './Cusha.vue'
import Xisha from './Xisha.vue'
import Luotong from './Luotong.vue'
import Dabao from './Dabao.vue'
export default {
  components: { Qinghua, Shumian, Jingshu, Bingtiao, Cusha, Xisha, Luotong, Dabao },
  data() {
    return {
      tabOption: [
        // { key_value: '1', key_name: '前纺', component: 'Qinghua' },
        // { key_value: '2', key_name: '梳棉', component: 'Shumian' },
        // { key_value: '3', key_name: '精梳', component: 'Jingshu' },
        // { key_value: '4', key_name: '并条', component: 'Bingtiao' },
        { key_value: '1', key_name: '前纺', component: 'Cusha' },
        { key_value: '2', key_name: '细纱', component: 'Xisha' },
        { key_value: '3', key_name: '络筒', component: 'Luotong' },
        // { key_value: '8', key_name: '打包', component: 'Dabao' }
      ],
      importVisible: false
    }
  },
  mounted() {},
  methods: {
    tabsChange(){
      // 获取对子组件的引用
      const childComponent = this.$refs.childComponentRef;
      childComponent.forEach((item) => {
        item.searchQuery()
      })
    }
  }
}
</script>

<style>
.background {
  height: 100%;
  background-color: white;
  border-radius: 5px;
  box-shadow: 1px 4px 4px rgba(0, 0, 0, 0.05);
}
</style>
